package com.qidian.buy.sso.controller;

import com.qidian.buy.sso.entity.UserBase;
import com.qidian.buy.sso.service.IUserBaseService;
import com.qidian.buy.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 戴着假发的程序员
 * @since 2024-05-16
 */
@RestController
@RequestMapping("/user")
public class UserBaseController {
    @Autowired
    private IUserBaseService userBaseService;
    @PostMapping("/reg")
    public QdResult reg(@RequestBody UserBase userBase){
        return userBaseService.reg(userBase,userBase.getCodeToken(), userBase.getCode());
    };
    @PostMapping("/login")
    public QdResult login(@RequestBody UserBase userBase){
        return userBaseService.login(userBase);
    }

    @GetMapping("/checkLogin")
    public QdResult checkLogin(String token){
        return userBaseService.checkLogin(token);
    }

}
